package cn.wolfcode.luowowo.search.query;

import cn.wolfcode.luowowo.common.query.QueryObject;
import lombok.Getter;
import lombok.Setter;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Pageable;
import org.springframework.data.domain.Sort;

@Setter
@Getter
public class DestintionQuery extends QueryObject {
    private Long time;
    private Long theme;
    private Long day;

    public Pageable getPageableNoSort() {
        //参数1:当前页 -1
        //参数2:每页显示条数
        //参数3:排序对象
        return PageRequest.of(super.getCurrentPage()-1, super.getPageSize());
    }
    public Pageable getPageable() {
        //参数1:当前页 -1
        //参数2:每页显示条数
        //参数3:排序对象//没加分页没有条数限制
        return PageRequest.of(super.getCurrentPage()-1, 10000,
                Sort.by(Sort.Direction.DESC, "hotNum"));
    }
}
